package com.java.socket;

import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;

public class ServerInputThread extends Thread {
	private Socket socket;

	public ServerInputThread(Socket socket) {
		this.socket = socket;
	}

	@Override
	public void run() {
		InputStream in = null;
		try {
			in = socket.getInputStream();
			while(true){
				byte[] bytes = new byte[1024];
				int length = in.read(bytes);
				String str = new String(bytes,0,length);
				System.out.print(str);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
